{% extends "geonode_base.html" %}
{% load i18n %}
{% load bootstrap_tags %}

{% block title %}{{ resource.title }} — {{ block.super }}{% endblock %}

{% block body_class %}data{% endblock %}

{% block body_outer %}

<style>

    .subtitle {
        font-size:16px;
        color: #428bca;
    }

    .sep_title hr {
        margin-top: 2px;
    }

</style>

<div class="page-header">
    {% if resource.class_name == "Document" %}
    <a href="{% url 'document_detail' docid=resource.id %}" class="btn btn-primary pull-right">{% trans "Return to Document" %}</a>
    {% elif resource.class_name == "Layer" %}
    <a href="{% url 'layer_detail' layername=resource.alternate %}" class="btn btn-primary pull-right">{% trans "Return to Layer" %}</a>
    {% elif resource.class_name == "Map" %}
    <a href="{% url 'map_detail' mapid=resource.id %}" class="btn btn-primary pull-right">{% trans "Return to Map" %}</a>
    {% elif resource.class_name == "GeoApp" %}
    <a href="{% url 'geoapp_detail' geoappid=resource.id %}" class="btn btn-primary pull-right">{% trans "Return to" %} {{ resource.type }}</a>
    {% endif %}
    <h2 class="page-title">{% trans "Metadata" %} : {{ resource.title }}</h2>
</div>


<article class="description tab-pane active" id="info">

    <span class="subtitle">{% trans "Identification" %}</span>
    <div class="sep_title"><hr></div>
    <dl class="dl-horizontal">
        {% block resource_title %}
        {% if resource.title %}
        <dt>{% trans "Title" %}</dt>
        <dd>{{ resource.title|truncatechars:80 }}</dd>
        {% endif %}
        {% endblock resource_title %}

        {% block abstract %}
        {% if resource.abstract %}
        <dt>{% trans "Abstract" %}</dt>
        <dd>{{ resource.abstract|safe }}</dd>
        {% endif %}
        {% endblock abstract %}

    </dl>

    <dl class="dl-horizontal">

        {% block license %}
        {% if LICENSES_ENABLED and LICENSES_DETAIL == 'above' and resource.license %}
        <dt>{% trans "License" %}</dt>
        <dd>{{ resource.license.name_long }} <a href="#license-more-above" data-toggle="collapse" data-target=".license-more-above"><i class="fa fa-info-circle"></i></a></dd>
        {% endif %}
        <dd class="license-more-above collapse">
            {% for bullet in resource.license.description_bullets %}
            {{ bullet }}<br/><br/>
            {% endfor %}
            {% if resource.license.url %}
            + {% trans "For more info see" %} <a href="{{ resource.license.url }}">{{ resource.license.url }}</a>.
            {% endif %}
        </dd>

        {% endblock license %}

        {% block date %}
        {% if resource.date %}
        <dt>{% trans resource.date_type|title %} {% trans "Date" %}</dt>
        <dd>{{ resource.date }}</dd>
        {% endif %}
        {% endblock date %}

        {% block display_type %}
        {% if resource.display_type %}
        <dt>{% trans "Type" %}</dt>
        <dd>{{ resource.display_type }}</dd>
        {% endif %}
        {% endblock display_type %}

        {% block keyword_list %}
        {% if resource.keyword_list %}
        <dt>{% trans "Keywords" %}</dt>
        <dd>{% for keyword in resource.keyword_list %}
            {{ keyword }}
            {% endfor %}</dd>
        {% endif %}
        {% endblock keyword_list %}

        {% block category %}
        {% if resource.category %}
        <dt>{% trans "Category" %}</dt>
        <dd><a href="/search/?category__identifier__in={{ resource.category.identifier }}">{{ resource.category }}</a> {% if resource.category.description %}<a href="#category-more" data-toggle="collapse" data-target=".category-more"><i class="fa fa-info-circle"></i></a>{% endif %}</dd>
        {% if resource.category.description %}
        <dd class="category-more collapse">
            {{ resource.category.description }}
        </dd>
        {% endif %}
        {% endif %}
        {% endblock category %}

        {% block regions %}
        {% if resource.regions.all %}
        <dt>{% trans "Regions" %}</dt>
        <dd>{{ resource.regions.all|join:", " }}</dd>
        {% endif %}
        {% endblock regions %}

        {% block is_approved %}
        <dt>{% trans "Approved" %}</dt>
        <dd>{% if resource.is_approved %} {% trans "Yes" %} {% else %} {% trans "No" %} {% endif %}</dd>
        {% endblock is_approved %}

        {% block is_published %}
        <dt>{% trans "Published" %}</dt>
        <dd>{% if resource.is_published %} {% trans "Yes" %} {% else %} {% trans "No" %} {% endif %}</dd>
        {% endblock is_published %}

        {% block featured %}
        <dt>{% trans "Featured" %}</dt>
        <dd>{% if resource.featured %} {% trans "Yes" %} {% else %} {% trans "No" %} {% endif %}</dd>
        {% endblock featured %}

        {% block group %}
        {% if resource.group %}
        <dt>{% trans "Group" %}</dt>
        <dd><a href="/groups/group/{{ resource.group.name }}/activity/">{{ group }}</a> </dd>
        {% endif %}
        {% endblock group %}

        {% block doi %}
        <dt>{% trans "DOI" %}</dt>
        <dd>{{ resource.doi }}</dd>
        {% endblock doi %}

        {% block attribution %}
        <dt>{% trans "Attribution" %}</dt>
        <dd>{{ resource.attribution }}</dd>
        {% endblock attribution %}

        {% block extra_tag %}{% endblock extra_tag %}
    </dl>


    <span class="subtitle">{% trans "Responsible" %}</span>
    <div class="sep_title"><hr></div>

    <dl class="dl-horizontal">

        {% if resource.owner %}
        {% with resource.owner as poc %}

        {% block name_long %}
        <dt>{% trans "Name" %}</dt>
        <dd>{{ poc.name_long }}</dd>
        {% endblock name_long %}

        {% block email %}
        <dt>{% trans "email" %}</dt>
        <dd>{{ poc.email }}</dd>
        {% endblock email %}

        {% block position %}
        <dt>{% trans "Position" %}</dt>
        <dd>{{ poc.position }}</dd>
        {% endblock position %}

        {% block organization %}
        <dt>{% trans "Organization" %}</dt>
        <dd>{{ poc.organization }}</dd>
        {% endblock organization %}

        {% block location %}
        <dt>{% trans "Location" %}</dt>
        <dd>{{ poc.location }}</dd>
        {% endblock location %}

        {% block voice %}
        <dt>{% trans "Voice" %}</dt>
        <dd>{{ poc.voice }}</dd>
        {% endblock voice %}

        {% block fax %}
        <dt>{% trans "Fax" %}</dt>
        <dd>{{ poc.fax }}</dd>
        {% endblock fax %}

        {% block poc_keyword_list %}
        {% if poc.keyword_list %}
        <dt>{% trans "Keywords" %}</dt>
        <dd>{% for keyword in poc.keyword_list %}
            {{ keyword }}
            {% endfor %}</dd>
        {% endif %}
        {% endblock poc_keyword_list %}

        {% endwith %}
        {% endif %}

    </dl>

    <span class="subtitle">{% trans "Information" %}</span>
    <div class="sep_title"><hr></div>

    <dl class="dl-horizontal">

        <dt>{% trans "Identification Image" %}</dt>
        <dd>
            <a href="{{ resource.get_thumbnail_url }}"><img ng-src="{{ resource.get_thumbnail_url }}" src="{{ resource.get_thumbnail_url }}"></a>
        </dd>

    </dl>

    <dl class="dl-horizontal">

        {% block scale %}
        <dt>{% trans "Spatial Extent" %}</dt>
        <dd>{% if resource.scale %} {{ resource.scale }} {% else %} --- {% endif %}</dd>
        {% endblock scale %}

        {% block srid %}
        <dt>{% trans "Projection System" %}</dt>
        <dd>{{ resource.srid }}</dd>
        {% endblock srid %}

                <dt>{% trans "Extension x0" %}</dt>

        {% block bbox_x0 %}
        <dd>{{resource.bbox_x0}}</dd>
        {% endblock bbox_x0 %}

        <dt>{% trans "Extension x1" %}</dt>
        {% block bbox_x1 %}
        <dd>{{resource.bbox_x1}}</dd>
        {% endblock bbox_x1 %}

        <dt>{% trans "Extension y0" %}</dt>
        {% block bbox_y0 %}
        <dd>{{resource.bbox_y0}}</dd>
        {% endblock bbox_y0 %}

        <dt>{% trans "Extension y1" %}</dt>
        {% block bbox_y1 %}
        <dd>{{resource.bbox_y1}}</dd>
        {% endblock bbox_y1 %}
    </dl>

    <span class="subtitle">{% trans "Features" %}</span>
    <div class="sep_title"><hr></div>

    <dl class="dl-horizontal">

        {% block license2 %}
        {% if LICENSES_ENABLED and LICENSES_DETAIL == 'below' and resource.license %}
        <dt>{% trans "License" %}</dt>
        <dd>{{ resource.license.name_long }} <a href="#license-more-below" data-toggle="collapse" data-target=".license-more-below"><i class="fa fa-info-circle"></i></a></dd>
        <dd class="license-more-below collapse">
            {% for bullet in resource.license.description_bullets %}
            {{ bullet }}<br/><br/>
            {% endfor %}
            {% if resource.license.url %}
            + {% trans "For more info see" %} <a href="{{ resource.license.url }}">{{ resource.license.url }}</a>.
            {% endif %}
        </dd>
        {% endif %}
        {% endblock license2 %}
        {% block maintenance_frequency %}
        {% if resource.maintenance_frequency %}
        <dt>{% trans "Maintenance Frequency" %}</dt>
        <dd>{{ resource.maintenance_frequency_title }}</dd>
        {% endif %}
        {% endblock maintenance_frequency %}

        {% block restriction_code_type %}
        {% if resource.restriction_code_type or resource.constraints_other %}
        <dt>{% trans "Restrictions" %}</dt>
        <dd>{% if resource.constraints_other %}
            {{ resource.constraints_other|safe }}
            {% else %}
            {{ resource.restriction_code_type }}
            {% endif %}</dd>
        {% endif %}
        {% endblock restriction_code_type %}

        {% block edition %}
        {% if resource.edition %}
        <dt>{% trans "Edition" %}</dt>
        <dd>{{ resource.edition}}</dd>
        {% endif %}
        {% endblock edition %}

        {% block purpose %}
        {% if resource.purpose %}
        <dt>{% trans "Purpose" %}</dt>
        <dd>{{ resource.purpose|safe }}</dd>
        {% endif %}
        {% endblock purpose %}

        {% block language %}
        {% if resource.language %}
        <dt>{% trans "Language" %}</dt>
        <dd>{{ resource.language_title }}</dd>
        {% endif %}
        {% endblock language %}

        {% block temporal_extent_start %}
        {% if resource.temporal_extent_start and resource.temporal_extent_end %}
        <dt>{% trans "Temporal Extent" %}</dt>
        <dd>{{ resource.temporal_extent_start }} - {{ resource.temporal_extent_end }}</dd>
        {% endif %}
        {% endblock temporal_extent_start %}

        {% block data_quality_statement %}
        {% if resource.data_quality_statement %}
        <dt>{% trans "Data Quality" %}</dt>
        <dd>{{ resource.data_quality_statement|safe }}</dd>
        {% endif %}
        {% endblock data_quality_statement %}

        {% block supplemental_information %}
        {% if resource.supplemental_information %}
        <dt>{% trans "Supplemental Information" %}</dt>
        <dd>{{ resource.supplemental_information|safe }}</dd>
        {% endif %}
        {% endblock supplemental_information %}

        {% block spatial_representation_type %}
        {% if resource.spatial_representation_type %}
        <dt>{% trans "Spatial Representation Type" %}</dt>
        <dd>{{ resource.spatial_representation_type }}</dd>
        {% endif %}
        {% endblock spatial_representation_type %}

    </dl>

    {% if resource.poc %}
    <span class="subtitle">{% trans "Contact Points" %}</span>
    <div class="sep_title"><hr></div>

    <dl class="dl-horizontal">

        {% block poc_name_long %}
        <dt>{% trans "Name" %}</dt>
        <dd>{{ resource.poc.name_long }}</dd>
        {% endblock poc_name_long %}

        {% block poc_email %}
        <dt>{% trans "email" %}</dt>
        <dd>{{ resource.poc.email }}</dd>
        {% endblock poc_email %}

        {% block poc_position %}
        <dt>{% trans "Position" %}</dt>
        <dd>{{ resource.poc.position }}</dd>
        {% endblock poc_position %}

        {% block poc_organization %}
        <dt>{% trans "Organization" %}</dt>
        <dd>{{ resource.poc.organization }}</dd>
        {% endblock poc_organization %}

        {% block poc_location %}
        <dt>{% trans "Location" %}</dt>
        <dd>{{ resource.poc.location }}</dd>
        {% endblock poc_location %}

        {% block poc_voice %}
        <dt>{% trans "Voice" %}</dt>
        <dd>{{ resource.poc.voice }}</dd>
        {% endblock poc_voice %}

        {% block poc_fax %}
        <dt>{% trans "Fax" %}</dt>
        <dd>{{ resource.poc.fax }}</dd>
        {% endblock poc_fax %}

        {% block poc_keyword %}
        {% if poc.keyword_list %}
        <dt>{% trans "Keywords" %}</dt>
        <dd>{% for keyword in resource.poc.keyword_list %}
            {{ keyword }}
            {% endfor %}</dd>
        {% endif %}
        {% endblock poc_keyword %}
        <hr>

    </dl>



    {% endif %}

    <span class="subtitle">{% trans "References" %}</span>
    <div class="sep_title"><hr></div>

    <dl class="dl-horizontal">

        {% block get_absolute_url %}
        <dt>{% trans "Link Online" %}</dt>
        <dd><a href="{{ resource.get_absolute_url }}">{{ resource.get_absolute_url }}</a></dd>
        {% endblock get_absolute_url %}

        {% block metaget_absolute_url %}
        <dt>{% trans "Metadata Page" %}</dt>
        <dd><a href="{{ resource.get_absolute_url }}/metadata_detail">{{ resource.get_absolute_url }}/metadata_detail</a></dd>
        {% endblock metaget_absolute_url %}

        {% block doc_file %}
        {% if resource.doc_file %}
        <dt>{% trans "Online Link" %}</dt>
        <dd><a href="{{ resource.get_absolute_url }}/download">{{ resource.get_absolute_url }}/download</a></dd>
        {% endif %}
        {% endblock doc_file %}

        <hr>

        {% if "download_resourcebase" in perms_list %}


            {% for link in resource.link_set.download %}
            <dt>{{link.name}}</dt>
            <dd><a href="{{link.url}}">{{resource.title}}.{{link.extension}}</a></dd>
            {% endfor %}

            <hr>

        {% endif %}

        {% for link in resource.link_set.ows %}
        <dt>{{link.name}}</dt>
        <dd><a href="{{link.url}}">Geoservice {{link.link_type}}</a></dd>
        {% endfor %}

    </dl>

    {% if resource.metadata_author %}
    <span class="subtitle">{% trans "Metadata Author" %}</span>
    <div class="sep_title"><hr></div>

    <dl class="dl-horizontal">

        {% with resource.metadata_author as poc %}

        {% block metadata_author_doc_file %}
        <dt>{% trans "Name" %}</dt>
        <dd>{{ poc.name_long }}</dd>
        {% endblock metadata_author_doc_file %}

        {% block metadata_author_email %}
        <dt>{% trans "email" %}</dt>
        <dd>{{ poc.email }}</dd>
        {% endblock metadata_author_email %}

        {% block metadata_author_position %}
        <dt>{% trans "Position" %}</dt>
        <dd>{{ poc.position }}</dd>
        {% endblock metadata_author_position %}

        {% block metadata_author_organization %}
        <dt>{% trans "Organization" %}</dt>
        <dd>{{ poc.organization }}</dd>
        {% endblock metadata_author_organization %}

        {% block metadata_author_location %}
        <dt>{% trans "Location" %}</dt>
        <dd>{{ poc.location }}</dd>
        {% endblock metadata_author_location %}

        {% block metadata_author_voice %}
        <dt>{% trans "Voice" %}</dt>
        <dd>{{ poc.voice }}</dd>
        {% endblock metadata_author_voice %}

        {% block metadata_author_fax %}
        <dt>{% trans "Fax" %}</dt>
        <dd>{{ poc.fax }}</dd>
        {% endblock metadata_author_fax %}

        {% block metadata_author_keyword_list %}
        {% if poc.keyword_list %}
        <dt>{% trans "Keywords" %}</dt>
        <dd>{% for keyword in poc.keyword_list %}
            {{ keyword }}
            {% endfor %}</dd>
        {% endif %}
        {% endblock metadata_author_keyword_list %}
        {% endwith %}

    </dl>
    {% endif %}


</article>


{% endblock %}
